package com.yy.sso.authority.center.controller;

import com.yy.sso.common.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;
import java.util.ArrayList;
import java.util.List;

@Slf4j
@RestController
//资源服务器
@EnableResourceServer
public class AuthController {

    @GetMapping(value = "/test")
    public Result<List<String>> test() {
        List<String> objects = new ArrayList<>();
        objects.add("aaaa");
        return Result.ok(objects);
    }

    @GetMapping("/user")
    public Principal user(Principal user){
        return user;
    }
}
